Conversation
tjconcept
left a comment
There was a problem hiding this comment.
Very nice! And a better introduction for me to Type definitions than reading any tutorials 😉
My main concern is whether I can keep this up-to-date when doing update in the future. It's a (minor) downside that the types are not in the code itself, it makes them prone to falling behind.
I will have another look one of the days and rigorously go through all sources to see if you have missed some methods etc. and then merge it.
| } | ||
| export interface PaylikeErrorConstructor extends Error { | ||
| new (message: string): PaylikeError | ||
| (message: string): PaylikeError |
There was a problem hiding this comment.
These two lines, are they to say that you can instantiate both with and without the new keyword? Or?
There was a problem hiding this comment.
I would assume so. I'm not 100% sure, this is from https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es6.d.ts
| before: (id: string) => Cursor<T> | ||
| limit: (limit: number) => Cursor<T> | ||
| stream: (highWaterMark: number) => any | ||
| toArray: () => Promise<Array<T>> |
There was a problem hiding this comment.
Could you add the missing methods as well? https://github.com/paylike/node-api#cursors-pagination
There was a problem hiding this comment.
Yes they and easily be added. I'll leave that as an exercise for you ;)
Unfortunately there are typings for pull-stream, that's why stream returns any right now.
|
Well keeping the definitions up to date is an issue when not writing Typescript yourself, then it would be a product of you publishing your NPM package. |
well it seems that your concern is not valid as it's been 6 years without any commits in the repo. I think this should be merged so that people could use the official package when using typescript and not have to implement their own or to hack this .d.ts into their project |
Added some typings for this lovely SDK.